<template>
	<view class="content">
		<view class="item">
			<view class="order_hint" v-if="ifShow">
				<image src="../../../static/image/order_hint.png"></image>
				<view>您还没有相关的预约</view>
			</view>
			<view class="it" v-for="(item, index) in myyuyueList" :key="index">
				<view class="it-hd">
					<view>住家月子服务({{item.days}}天)</view>
					<view>全额: ￥{{item.payable_price}}元</view>
				</view>
				<view class="it-bd">
					<view class="headImg">
						<image :src="item.head_url" mode=""></image>
					</view>
					<view class="desc">
						<view class="userName">{{item.name}}<view><image src="/static/image/attestation1.png"></image>母婴学院认证</view></view>
						<view class="priceBox">已支付：<text class="price">￥{{item.payable_price}}元</text></view>
						<view class="time">预约时间：{{item.start_time}}</view>
					</view>
				</view>
				<view class="it-ft">
					<view class="warning"><uni-icon type="warning" size="18" color="#fec501"></uni-icon>您已成功预约，月嫂将准时到达</view>
					<button class="submit">已成功预约</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uniIcon from "@/components/uni-icon/uni-icon.vue";
	import {dns} from "@/pages/dns.js";
	export default {
		data(){
			return {
				myyuyueList: [],
				ifShow: false
			}
		},
		components: {
			uniIcon
		},
		onLoad() {
			this.getmyyuyue()
		},
		methods:{
			getmyyuyue(){//获取预约列表
				uni.request({
					method: 'GET',
					data: {
						status: 1
					},
					header:{
						token: uni.getStorageSync("token")
					},
					url: dns + 'order/list',
					success: (res)=>{
						console.log(res)
						if(res.data.status == -1){
							uni.showToast({
								icon: 'none',
								title: res.data.msg
							})
							return;
						}
						if(res.data.status == 0){
							this.ifShow = true;
						}
						if(res.data.status == 1){
							this.myyuyueList = res.data.data;
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		height: 100%;
	}
	.content{
		background-color: #f6f6f6;
		height: 100%;
		padding-top: 10upx;
		.item{
			position: relative;
			background-color: #f6f6f6;
			height: 100%;
			.order_hint{
				position: absolute;
				top: 40%;
				left: 50%;
				transform: translate(-50%,-50%);
				image{
					width: 400upx;
					height: 400upx;
				}
				view{
					text-align: center;
					font-size: 30upx;
					margin-top: -50upx;
				}
			}
			.it{
				padding: 20upx 40upx;
				background-color: #fff;
				margin-bottom: 14upx;
				.it-hd{
					font-size: 28upx;
					color: #000;
					display: flex;
					justify-content: space-between;
				}
				.it-bd{
					display: flex;
					margin-top: 30upx;
					position: relative;
					.headImg{
						width: 110upx;
						height: 110upx;
						border-radius: 50%;
						overflow: hidden;
						image{
							width: 100%;
							height: 100%;
						}
					}
					.desc{
						margin-left: 30upx;
						.userName{
							display: flex;
							font-size: 34upx;
							margin-bottom: 6upx;
							vertical-align:middle;
							view{
								position: relative;
								image{
									position: absolute;
									top: 6upx;
									left: 0upx;
									width: 32upx;
									height: 32upx;
									line-height: 36upx;
									margin-left: 14upx;
								}
								padding-left: 44upx;
								font-size: 20upx;
								color: #f5994c;
								line-height: 46upx;
							}
						}
						.priceBox{
							font-size: 24upx;
							color: #7f7f7f;
							margin-bottom: 6upx;
							.price{
								color: #ff5c5d;
							}
						}
						.time{
							font-size: 24upx;
							color: #7f7f7f;
						}
					}
				}
				.it-ft{
					margin-top: 30upx;
					display: flex;
					justify-content: space-between;
					height: 50upx;
					button{
						margin: 0;
						border: none;
						width: 156upx;
						padding: 0;
						display: inline-block;
						background-color: #fff;
						font-size: 24upx;
						line-height: 52upx;
						text-align: center;
						border: 2upx solid #d0d0d0;
						border-radius: 30upx;
						margin-left: 20upx;
						color: #7f7f7f;
					}
					.warning{
						font-size: 24upx;
						position: relative;
						padding-left: 40upx;
						line-height: 48upx;
						uni-icon{
							position: absolute;
							top: 6upx;
							left: 0;
						}
						text{
						}
					}
					.submit{
						border: 2upx solid #f3a47c;
						color: #f5984b;
						line-height: 50upx;
					}
					button::after{
						content: '';
						width: 0;
						height: 0;
					}
				}
			}
		}
	}
</style>
